翻訳と辞書
Words near each other
・ tactile user interface
・ tag
・ tag name
・ tagged image file format
・ tagged queueing
・ tagged types
・ tail call optimisation
・ tail call optimization
・ tail circuit
・ tail recursion
tail recursion modulo cons
・ tail recursion optimisation
・ tail-strict
・ tal
・ tale
・ taligent
・ talk
・ talk bomb
・ talk mode
・ talker system


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

tail recursion modulo cons : FOLDOC
tail recursion modulo cons
A generalisation of tail recursion introduced by D.H.D. Warren. It applies when the last thing a function does is to apply a constructor functions (e.g. cons) to an application of a non-primitive function. This is transformed into a tail call to the function which is also passed a pointer to where its result should be written. E.g.
f [] = []
f (x:xs) = 1 : f xs

is transformed into (pseudo C/Haskell):
f [] = []
f l = f' l allocate_cons

f' [] p = { *p = nil;
return *p
}
f' (x:xs) p = { cell = allocate_cons;
*p = cell;
cell.head = 1;
return f' xs &cell.tail
}

where allocate_cons returns the address of a new cons cell, *p is the location pointed to by p and &c is the address of c.
[D.H.D. Warren, DAI Research Report 141, University of Edinburgh


スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.